23. Widgets Summary

Summary

That’s all for this lesson! Let’s recap on what we’ve learned in it:

  • Widgets are a fun and easy way to interact with any app, but they could be resource intensive if not managed properly
  • Widgets handle their own update schedule, but remember that they run on the main UI thread so to offload any heavy tasks to a new thread
  • IntentServices are a great way to do so, they can communicate back to the widget at any time
  • Widgets layouts are based on RemoteViews, which for the most part behave like normal Views with some exceptions like:
    • Click events are handled with pending intents and collections need a PendingIntent Template
    • Not all view types are supported
    • Collection views require a remote service and a remote view factory to act as an adapter

Now that we’re done, feel free to explore more of the widget capabilities like building animations using ViewFlipper or flipping through photo galleries using Stack Views.